package com.baselibrary.base.mvvm

import com.baselibrary.UserInfo
import com.baselibrary.bean.*
import com.baselibrary.net.result.HttpResult
import io.reactivex.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

interface BaseApi {
    /**
     * 添加关注
     *
     */
    @FormUrlEncoded
    @POST("focusFans/add")
    fun reqAddFollow(@Field("token") token: String, @Field("type") type: Int, @Field("thirdId") thirdId: Int): Observable<HttpResult<Boolean>>

    /**
     * 添加关注
     *
     */
    @FormUrlEncoded
    @POST("focusFans/v1.19.3/add")
    fun reqAddFollow2(@Field("token") token: String, @Field("type") type: Int, @Field("thirdId") thirdId: Int): Observable<HttpResult<FollowSuccBean>>

    /**
     * 取消关注
     *
     * @return
     */
    @FormUrlEncoded
    @POST("focusFans/del")
    fun reqCancelFollow(@Field("token") token: String, @Field("type") type: Int, @Field("thirdId") typeId: Int): Observable<HttpResult<Boolean>>

    /**
     * 取消关注
     *
     * @return
     */
    @FormUrlEncoded
    @POST("focusFans/v1.19.3/del")
    fun reqCancelFollow2(@Field("token") token: String, @Field("type") type: Int, @Field("thirdId") typeId: Int): Observable<HttpResult<FollowSuccBean>>

    /**
     * 添加收藏
     * @return
     */
    @FormUrlEncoded
    @POST("web/favorite/add")
    fun reqAddCollection(@Field("token") token: String, @Field("type") type: Int, @Field("typeId") typeId: Long): Observable<HttpResult<Boolean>>

    /**
     * 取消收藏
     * type"类型：1文章 2产品 3课程 4动态 5讲坛 6专栏 7约局
     * @return
     */
    @FormUrlEncoded
    @POST("web/favorite/delete")
    fun reqCancelCollection(@Field("token") token: String, @Field("type") type: Int, @Field("typeId") typeId: Long): Observable<HttpResult<Boolean>>

    /**
     * 点赞
     *
     * @return
     */
    @FormUrlEncoded
    @POST("web/support/add")
    fun reqAddSupport(@Field("token") token: String, @Field("type") type: Int, @Field("typeId") typeId: Int): Observable<HttpResult<Boolean>>

    /**
     * 取消点赞
     *
     * @return
     */
    @FormUrlEncoded
    @POST("web/support/delete")
    fun reqCancelSupport(@Field("token") token: String, @Field("type") type: Int, @Field("typeId") typeId: Int): Observable<HttpResult<Boolean>>

    /**
     * 好友列表
     *
     * @return
     */
    @FormUrlEncoded
    @POST("friends/getFriendsList")
    fun reqFriendList(@Field("keyWord") keyWord: String, @Field("token") token: String): Observable<HttpResult<List<FriendListBean>>>

    /**
     * 删除动态
     *
     * @return
     */
    @FormUrlEncoded
    @POST("timeline/delete")
    fun deleteTimeline(@Field("token") token: String, @Field("tid") tid: String, @Field("status") status: String): Observable<HttpResult<String>>

    /**
     * 获取首页瀑布流
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("homePage/stream")
    fun requestStream(@Field("token") token: String?, @Field("tab") tab: Int?, @Field("page") page: String?, @Field("cursor") cursor: String?): Observable<HttpResult<StreamData.DataDTO?>?>?

    /**
     * 获取频道页瀑布流
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("tag/tagCategoryTimeline")
    fun requestChannelTimeline(@Field("token") token: String?, @Field("tagCategoryId") tagCategoryId: Int?, @Field("page") page: String?, @Field("cursor") cursor: String?): Observable<HttpResult<DynamicInfoBean.DataBeanX>?>?

    /**
     * 获取最热和最新动态
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("tag/tagTimelineList")
    fun requestHotAndLatest(@Field("token") token: String?, @Field("page") page: String?, @Field("size") size: String?, @Field("tid") tid: String?, @Field("type") type: String?): Observable<HttpResult<DynamicInfoBean.DataBeanX?>?>?

    /**
     * 更新用户信息
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("web/user/getUserInfo")
    fun reqUpUserInfo(@Field("token") token: String): Observable<HttpResult<UserInfo.DataBean>>


    /**
     * 获取用户发布的动态
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("timeline/userTimeline")
    fun requestUserTimeline(@Field("token") token: String?, @Field("cursor") page: String?, @Field("size") size: String?, @Field("uid") uid: String?): Observable<HttpResult<DynamicInfoBean.DataBeanX>?>?


    /**
     * 获取酒窖发布的动态
     *
     * @param token
     * @return
     */
    @Deprecated("目前都使用用户动态")
    @FormUrlEncoded @POST("timeline/getWineryTimeline")
    fun requestWineryTimeline(@Field("token") token: String?, @Field("page") page: String?, @Field("size") size: String?, @Field("wineryCode") wineryCode: String?): Observable<HttpResult<DynamicInfoBean.DataBeanX>?>?

    /**
     * 获取用户收藏的动态和话题
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("web/favorite/pager")
    fun requestUserCollection(@Field("token") token: String?, @Field("cursor") page: String?, @Field("size") size: String?, @Field("type") type: String?, @Field("uid") uid: String?): Observable<HttpResult<DynamicInfoBean.DataBeanX>?>?

    /**
     * 获取用户赞过的动态和话题
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("timeline/person/liked")
    fun requestUserLiked(@Field("token") token: String?, @Field("page") page: String?, @Field("size") size: String?, @Field("id") id: String?): Observable<HttpResult<DynamicInfoBean.DataBeanX>?>?

    /**
     * 话题内搜索
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("tag/searchTimeline")
    fun requestSearchTopic(@Field("token") token: String?, @Field("page") page: String?, @Field("size") size: String?, @Field("tid") tid: String?, @Field("keyword") keyword: String?): Observable<HttpResult<DynamicInfoBean.DataBeanX>?>?

    /**
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("timeline/addForwardNum")
    fun reqAddShareNum(@Field("token") token: String, @Field("id") id: Long): Observable<HttpResult<Any>>

    /**秒杀--添加预约
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("seckill/subscribe/add")
    fun reqSeckillAddSubscribe(@Field("actId") actId: String): Observable<HttpResult<SeckillAddSubscribeBean>>

    /**秒杀--取消预约
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("seckill/subscribe/cancel")
    fun reqSeckillCancelSubscribe(@Field("actId") actId: String): Observable<HttpResult<Any>>

    /**根据类型获取banner列表（首页大改版）
     * @param bannerType： banner类型 0首页banner 1商城banner 2附近banner 3中心banner 4话题轮播图
     * @return
     */
    @FormUrlEncoded
    @POST("homePage/v1.0/getBannerConfigList")
    fun reqGetBannerConfigList(@Field("bannerType") bannerType: Int,@Field("otherId") otherId: Long=-1): Observable<HttpResult<BannerConfigListBean>>

    /**获取热词列表（首页大改版）
     * @param areaType  位置0首页 1商城
     * @return
     */
    @FormUrlEncoded
    @POST("homePage/v1.0/getCarouselHotWordList")
    fun reqGetCarouselHotWordList(@Field("areaType") areaType: Int): Observable<HttpResult<List<HotWordListBean>>>

}